#ifndef UCH_H
#define UCH_H

#include <stdint.h>
#include <stddef.h>

#define PRI_UCH "%.4s"

/* type capable of holding a utf-8 character */
typedef uint32_t Uch;

/* length in bytes of next utf-8 character in str */
size_t
ch_lenf(const char *str);

/* length in bytes of previous utf-8 character in str,
   do not use at start of string
*/
size_t
ch_lenb(const char *str);

/* length in bytes of character ch as utf-8 character */
size_t
ch_len(Uch ch);

/* returns first utf-8 character in str and if len is not NULL
   writes length in bytes to len
*/
Uch
uch(const char *str, size_t *len);

#endif
